package org.harsh.transmission.common;

import lombok.Getter;

/**
 * 传输类型
 */
@Getter
public enum TaskType {
    UNICAST(0, "单播"),
    MULTICAST(1, "组播"),
    BROADCAST(2, "广播"),
    UNIDIRECTIONAL_TRANSMISSION(3, "单向传输"),
    ;

    private final int type;

    private final String desc;

    TaskType(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static TaskType valueOf(int type) {
        for (TaskType taskType : values()) {
            if (taskType.type == type) {
                return taskType;
            }
        }
        return null;
    }

    public boolean equals(int type) {
        return this.type == type;
    }

}
